//
//  TradeControlModel.m
//  BTCoin
//
//  Created by Robin on 29/03/2018.
//  Copyright © 2018 Robin. All rights reserved.
//

#import "TradeControlModel.h"

@implementation TradeModel
- (NSInteger)getTradeSymbol {
    NSInteger type = -1;
    if ([self.region isEqualToString:USDT]) {
        if ([self.type isEqualToString:LTC]) {
            type = 2;
        } else if ([self.type isEqualToString:ETH]) {
            type = 3;
        } else if ([self.type isEqualToString:ETC]) {
            type = 4;
        } else if ([self.type isEqualToString:BTC]) {
            type = 13;
        }
    } else if ([self.region isEqualToString:BTC]) {
        if ([self.type isEqualToString:ETH]) {
            type = 5;
        } else if ([self.type isEqualToString:ETC]) {
            type = 3;
        }
    }
    
    return type;
}

@end

@implementation TradeControlModel

- (instancetype)init {
    self = [super init];
    if (self) {
        _buyModel = [[TradeModel alloc] init];
        _tradeTypeArray = [[NSMutableArray alloc] init];
    }
    
    return self;
}

#pragma mark - public methods
- (CoinType)getCurrentTradeCoinType {
    NSString * type = [self.currentTradeType stringByReplacingOccurrencesOfString:@"(CNY)" withString:@""];
    return [CoinTypeDict[type] integerValue];
}

@end

